package com.qys.livesMall.app.user.enums;

import java.math.BigDecimal;
import java.math.RoundingMode;

public enum GoldAccountRecordTypeEnum {

    /**
     * 赠送直播礼物
     **/
    GIVE_LIVES_GIFT((byte) 1, "用户%s赠送直播礼物--之前金币:%s-当前余额:%s"),
    /**
     * 余额兑换金币
     **/
    BALANCE_EXCHANGE_GOLD((byte) 2, "用户%s兑换金币--之前金币:%s-当前余额:%s");

    private Byte type;
    private String remark;

    private GoldAccountRecordTypeEnum(Byte type, String remark) {
        this.type = type;
        this.remark = remark;
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public String getRemark(String userName, BigDecimal goldAmount, BigDecimal goldOldAmount) {
        return String.format(remark, userName,
                goldAmount.setScale(2, RoundingMode.FLOOR),
                goldOldAmount.setScale(2, RoundingMode.FLOOR));
    }
}
